$('.login0').on('click', function () {
    $('.login1').eq($(this).index()).css('display', 'block').siblings().css('display', 'none')
})
$('form').find('.sub').click(function () {
    console.log('11');
    $.ajax({
        url: "../php/login.php",
        type: "post",
        dataType: "json",
        data: {
            un: $('#un').val(),
            pw: $('#pw').val()
        },
        success: function (data) {
            if (data.code == 1) {
                alert('登陆成功,马上跳转购物车页面')
                location.href = "../pages/cart.html"
            }
            if (data.code == 0) {
                alert('用户名或账号错误,请重新登入')
            }
        }
    })
})
$('.reg').find('a').click(function () {
    location.href = "../pages/register.html"
})

